Skip to content

fix(bootstrap): skip backup peer list when no bootstrap peers configured - #1213

Open
karawitan wants to merge 1 commit into
ipfs:mainfrom
karawitan:fix/bootstrap-skip-backup-when-no-peers
Open

fix(bootstrap): skip backup peer list when no bootstrap peers configured#1213
karawitan wants to merge 1 commit into
ipfs:mainfrom
karawitan:fix/bootstrap-skip-backup-when-no-peers

Conversation

@karawitan

@karawitan karawitan commented Sep 7, 2026

Copy link
Copy Markdown

Problem

When a node has no bootstrap peers configured (for example Routing.Type=none with an empty Bootstrap list, or ipfs daemon --routing=none), bootstrapRound still loads and dials backup peers persisted from previous runs (stored under TempBootstrapPeersKey in the datastore). This causes unwanted external DNS resolution and connection attempts to stale addresses every 30 seconds, even though the operator explicitly disabled routing/bootstrap. Reported in kubo#11452.

The backup peer list exists as a recovery mechanism for when configured bootstrap peers are down (#8856). With no configured bootstrap peers, there is nothing to recover from, so consulting the backup list is the wrong behavior.

Fix

In bootstrapRound, return early when cfg.BootstrapPeers() returns an empty list, before consulting the backup peer list. This:

  • Covers Bootstrap: null / empty list (becomes an empty []peer.AddrInfo)
  • Works with ipfs daemon --routing=none (runtime override that does not change the config file)
  • Keeps Routing.Type=none + explicit Bootstrap peers working (those nodes still dial their configured peers)
  • Needs no new config option

Nodes that configure explicit Bootstrap peers are unaffected: the backup-list fallback still runs when those peers fail to connect.

Behavior change

Previously, a node with default routing and an empty Bootstrap list would still dial backup peers. After this change it does not. This aligns behavior with operator intent: an empty Bootstrap list now means "no bootstrap dialing at all, including saved backup peers." This is a fix, directed by @lidel in kubo#11453 (review): "The simplest fix is in boxo, in bootstrap.bootstrapRound: when cfg.BootstrapPeers() returns nothing, stop there instead of trying the backup list."

Testing

  • go build ./bootstrap/... passes
  • go test ./bootstrap/... -count=1 passes (all existing tests green)
  • go vet ./bootstrap/... passes
  • gofmt -l bootstrap/ clean
  • Added TestBootstrapRoundSkipsBackupWhenNoBootstrapPeers: verifies bootstrapRound does not call loadBackupBootstrapPeers when BootstrapPeers() is empty
  • Added TestBootstrapRoundDialsBackupWhenBootstrapPeersPresent: verifies the backup list is still consulted when configured bootstrap peers fail to connect, preserving the #8856 recovery mechanism

Companion kubo PR

REQUIRED companion kubo PR: ipfs/kubo#11453 (reworked to pin this boxo branch, fix docs, and add a kubo-level regression test). It is a draft while this boxo PR is unmerged; kubo CI status will be reported there.

Generated with Devin

@karawitan
karawitan requested a review from a team as a code owner September 7, 2026 07:12
bootstrapRound no longer consults the backup peer list when
cfg.BootstrapPeers() returns empty. The backup list exists only as a
recovery mechanism for when configured bootstrap peers are down
(#8856); with no configured peers there is nothing to recover from,
so dialing stale backup peers persisted from previous runs is
skipped.

This lets a caller fully disable bootstrap dialing by setting an
empty peer list (for example a local-only/offline node with
Routing.Type=none), and works with runtime overrides such as
`ipfs daemon --routing=none` that do not change the config file.
Nodes that configure explicit Bootstrap peers are unaffected.

Closes kubo issue #11452 (companion kubo PR to follow).

Generated with [Devin](https://devin.ai)

Co-Authored-By: Devin <158243242+devin-ai-integration[bot]@users.noreply.github.com>
@karawitan
karawitan force-pushed the fix/bootstrap-skip-backup-when-no-peers branch from fc791c5 to 76cf61a Compare September 7, 2026 07:12
karawitan pushed a commit to karawitan/kubo that referenced this pull request Sep 7, 2026
Rework of ipfs#11453 per maintainer review (lidel): the fix belongs in
boxo (bootstrap.bootstrapRound skips the backup list when no
bootstrap peers are configured), not behind a Routing.Type=none guard
in kubo. This PR is now the companion to ipfs/boxo#1213:

- Pin the boxo fix via a temporary replace directive pointing at the
  boxo PR branch. Once ipfs/boxo#1213 merges, repoint at boxo main
  and convert to a pseudo-version pin.
- Add a kubo-level regression test
  (TestBootstrapWithEmptyPeerListAndStaleBackupPeers) verifying
  IpfsNode.Bootstrap runs with an empty Bootstrap config and a
  populated TempBootstrapPeersKey without error.
- Document under Bootstrap in docs/config.md that an empty list
  disables all bootstrap dialing, including saved backup peers.
- Add a v0.44 changelog highlight. Drop the v0.43 entry and the
  broken emoji from the original PR.

Closes ipfs#11452

Generated with [Devin](https://devin.ai)

Co-Authored-By: Devin <158243242+devin-ai-integration[bot]@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant